package com.lishe.lishe.lishe.base.view;

import android.content.Context;
import android.graphics.Typeface;
import android.util.AttributeSet;
import android.widget.Button;

import com.lishe.lishe.lishe.base.BaseApplication;

/**
 * Created by zhcase on 2017/9/16.
 */

public class FontButton extends Button {

    public FontButton(Context context) {
        super(context);
        setTypefaceStyle(Typeface.NORMAL);
    }

    public FontButton(Context context, AttributeSet attrs) {
        super(context, attrs);
        setTypefaceStyle(Typeface.NORMAL);
    }

    public FontButton(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

    public FontButton(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
        super(context, attrs, defStyleAttr, defStyleRes);
        setTypefaceStyle(Typeface.NORMAL);
    }

    public void setTypefaceStyle(int style) {
        if (style == Typeface.BOLD) {
            super.setTypeface(BaseApplication.getTypeFaceMedium());

        } else {
            super.setTypeface(BaseApplication.getTypefaceRegular());
        }
    }
}
